1. Field of the Invention
The present invention relates to an entropy encoding apparatus, entropy encoding method, and computer program.
2. Description of the Related Art
Recent advances in digital signal processing and increases in LSI circuit density and speed have enabled high-efficiency encoding of a large volume of digital information such as moving images, still images, and voice, allowing them to be recorded on recording media and transmitted via communications media. A moving image encoding apparatus which can convert video images of TV broadcasting or a digital video camera into a stream is being developed using such technology.
As a standard for moving image encoding, H.264 (AVC) worked out by the ITU-T has been attracting attention in recent years. H.264 implements higher-efficiency encoding than MPEG which is a conventional standard for moving image encoding. The factors which have enabled H.264 to implement high-efficiency encoding include entropy encoding. In particular, as a method for implementing high-efficiency entropy encoding, H.264 adopts an entropy coding using arithmetic coding known as CABAC (Context Adaptive Binary Arithmetic Coding). CABAC is described in Japanese Patent Laid-Open No. 2004-135251.
Main components of CABAC as an entropy encoding unit adopted by H.264 are shown in FIG. 4. Syntax elements which serve as input data to the entropy encoding unit 400 include motion vector information, transform coefficients, quantization parameter, and the like, each of which is a multi-valued signal. CABAC mainly consists of the following four units.
A first unit is a binarization unit 401 which binarizes syntax elements—which are multi-valued input data—using a binarizing method defined for each type of syntax element and outputs binarized data D42. The binarization unit 401 also outputs information D41 needed to generate a context index to a context calculation unit 402. The context index and the context calculation are described later.
A second unit is the context calculation unit 402 which outputs a context index D43 defining context information for each bit of binarized data D42. The context information includes most probable symbol and probability state index and is a signal used by a binary arithmetic coding unit 404. The binary arithmetic coding unit 404 is described later. The most probable symbol is a value of a symbol which, being defined for each bit of the binarized data D42 output from the binarization unit 401, has a statistically high event probability. The probability state index is the data which indirectly represents the event probability of the symbol value.
In CABAC, context information is updated during encoding based on results of the encoding and thereby context information suitable for input data is constructed in the process of encoding. Using context information which behaves in this way, CABAC coding implements high-efficiency encoding.
Also, ITU-T Recommendation H.264 indirectly defines initial values for 460 types of context information. The 460 types of context information are managed by the context index D43. The context index D43 takes a value from 0 to 459 (both inclusive) and each value of the context index D43 corresponds to one piece of context information.
Returning to FIG. 4, a third unit is a context memory unit 403 which holds the context information. The context memory unit 403 is a storage unit which holds context information for each context index D43 generated by the context calculation unit 402. The context memory unit 403 outputs the context information D44 to the binary arithmetic coding unit 404.
A fourth unit is the binary arithmetic coding unit 404 which performs arithmetic coding using the context information D44 and binarized data D42.
According to ITU-T Recommendation H.264, CABAC prescribes that the context information should be initialized each time a new slice is encoded. That is, when the head of a slice is detected during CABAC-based encoding, the context information held in the context memory unit 403 is initialized. The initialization process is followed by an encoding process.
A temporal relationship between the initialization process and encoding will be described with reference to FIG. 5. A frame 501 shown at the top of FIG. 5 shows one of the frames which is divided into n slices. A graph at the bottom of FIG. 5 shows processing time of initialization processes and processing time of the CABAC encoding along a time axis represented by the abscissa.
When the head of slice #1 is detected at time t1, an initialization process of slice #1 is started at time t1 and 460 types of context information are initialized. The initialization process of context information in slice #1 is ended at time t2 and then an encoding process is started using the initialized context information. At time t3, if the head of slice #2 is detected, an initialization process of context information in slice #2 is started in a similar manner. The initialization process of the context information in slice #2 is ended at time t4 and then an encoding process is started using the initialized context information.
Since there are 460 types of context information, the initialization process described above requires a correspondingly large amount of processing time. Also, in a case where one frame is configured by a plurality of slices, the initialization process of the context information is performed for the number of the slices. Thus, conventional techniques have a problem in that much processing time is required due to the large amounts of computation required to generate the initial values of context information.
The present invention provides a technique for reducing processing cycles required to initialize context information, thereby speeding up initialization of the context information.